package net.code.btalk;

import java.util.Vector;

import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;

public class SavedData {
	private static final long USER_INFO_ID = 0x730a7fda314c41dcL;
	private static final long OPTIONS_ID = 0x6c69ee88659ab5acL;
	
	public static boolean save_account;
	public static boolean use_ssl;
	
	public static void setUserInfo(String username, String password) {
		PersistentObject store = PersistentStore.getPersistentObject(USER_INFO_ID);
		Vector up = new Vector();
		up.addElement(username);
		up.addElement(password);
		
		synchronized (store) {
			store.setContents(up);
			store.commit();
		}
	}
	
	public static Vector getUserInfo() {
		PersistentObject store = PersistentStore.getPersistentObject(USER_INFO_ID);
		Vector up;
		
		synchronized (store) {
			up = (Vector) store.getContents();
		}
		
		return up;
	}
	
	public static void destroyUserInfo() {
		PersistentStore.destroyPersistentObject(USER_INFO_ID);
	}
}
